Listop

Syntax: @Listop list_attribute, [ADD/DEL/SET], variable

The @Listop command allows the value in a variable to be added or deleted in the current set of selected values for a multi select list object. The @Assign command can also manipulate the selected values of a multi select list object.

Note that this updates the list of SELECTED values (e.g. user selected), and does not add or remove values from the list of DEFINED values shown on the Instances editor.

The variable can be any string (variable or literal). These points should be appreciated:

·Adding a value, using ADD, that does not exist in the DEFINED list of values, will not cause an immediate error (i.e. the Listop command will not report an error), but an error will be reported when inference next uses the list attribute. This is also the case when a List type attribute is assigned an illegal value.

·Adding a legal value (a DEFINED value) that is already selected is simply ignored. i.e. the value just remains selected.

·Deleting a legal value, using DEL that is not already selected is ignored, and trying to delete an illegal value is also ignored.

·Using SET clears the current list of selected values, and then effectively ADD's the specified variable as being the only one selected.

If SET is followed by a null value, e.g. @Listop Color, Set, '' this clears the set of SELECTED values. This DOES NOT have the effect of setting the attribute status to 'unknown', as would be the case if you used @Clear as an alternative.

Examples

@Listop Color, ADD, 'Red'

This command would add Red to the list of selected values for the list attribute called Color.

An alternative to using @Listop

Note that values can be assigned to multi select list objects using @Assign and placing the values in square brackets, for example:

@Assign myList = []
@Assign myList = ['c']
@Assign myList = myList + ['b']
@Assign myList = myList - ['c']
@Assign myList = ['a','d']